//
//  HomeMuneViewController.m
//  Dome
//
//  Created by 沙斌 on 16/4/18.
//  Copyright © 2016年 Dxy. All rights reserved.
//

#import "HomeMuneViewController.h"
#import <QuartzCore/QuartzCore.h>

@interface HomeMuneViewController ()

@end

@implementation HomeMuneViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self additem];
    [self viewFrame];
    [self addlabel];
    [self setLabelView];
    
    self.view.backgroundColor =[UIColor whiteColor];
    
//    self.view.layer.borderWidth = 1;
//    self.view.layer.borderColor = [[UIColor grayColor] CGColor];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

-(void)additem{
    
    _wsgw = [[UIButton alloc]init];
    _wsgw.layer.cornerRadius = 4.0f;
   // _wsgw.backgroundColor = [UIColor redColor];
    [_wsgw setImage:[UIImage imageNamed:@"wsgw"] forState:UIControlStateNormal];
    [_wsgw setImage:[UIImage imageNamed:@""] forState:UIControlStateHighlighted];
    [_wsgw addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_wsgw];
    
    _dc = [[UIButton alloc]init];
    _dc.layer.cornerRadius = 4.0f;
  //  _dc.backgroundColor = [UIColor redColor];
    [_dc setImage:[UIImage imageNamed:@"dc"] forState:UIControlStateNormal];
    [_dc setImage:[UIImage imageNamed:@""] forState:UIControlStateHighlighted];
    [_dc addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];

    [self.view addSubview:_dc];
    
    _gh = [[UIButton alloc]init];
    _gh.layer.cornerRadius = 4.0f;
   // _gh.backgroundColor = [UIColor redColor];
    [_gh setImage:[UIImage imageNamed:@"gh"] forState:UIControlStateNormal];
    [_gh setImage:[UIImage imageNamed:@""] forState:UIControlStateHighlighted];
     [self.view addSubview:_gh];
    
    _cgyd = [[UIButton alloc]init];
    _cgyd.layer.cornerRadius = 4.0f;
   // _cgyd.backgroundColor = [UIColor redColor];
    [_cgyd setImage:[UIImage imageNamed:@"ydcg"] forState:UIControlStateNormal];
    [_cgyd setImage:[UIImage imageNamed:@""] forState:UIControlStateHighlighted];
     [self.view addSubview:_cgyd];
    
    _sxps = [[UIButton alloc]init];
    _sxps.layer.cornerRadius = 4.0f;
   // _sxps.backgroundColor = [UIColor redColor];
    [_sxps setImage:[UIImage imageNamed:@"sxps"] forState:UIControlStateNormal];
    [_sxps setImage:[UIImage imageNamed:@""] forState:UIControlStateHighlighted];
     [self.view addSubview:_sxps];
    
    _jzfw = [[UIButton alloc]init];
    _jzfw.layer.cornerRadius = 4.0f;
   // _jzfw.backgroundColor = [UIColor redColor];
    [_jzfw setImage:[UIImage imageNamed:@"jzfw"] forState:UIControlStateNormal];
    [_jzfw setImage:[UIImage imageNamed:@""] forState:UIControlStateHighlighted];
     [self.view addSubview:_jzfw];
    
    _zhbx = [[UIButton alloc]init];
    _zhbx.layer.cornerRadius = 4.0f;
   // _zhbx.backgroundColor = [UIColor redColor];
    [_zhbx setImage:[UIImage imageNamed:@"zhbx"] forState:UIControlStateNormal];
    [_zhbx setImage:[UIImage imageNamed:@""] forState:UIControlStateHighlighted];
     [self.view addSubview:_zhbx];
    
    _dd = [[UIButton alloc]init];
    _dd.layer.cornerRadius = 4.0f;
   // _dd.backgroundColor = [UIColor redColor];
    [_dd setImage:[UIImage imageNamed:@"sp"] forState:UIControlStateNormal];
    [_dd setImage:[UIImage imageNamed:@""] forState:UIControlStateHighlighted];
     [self.view addSubview:_dd];
    
}

-(void)viewFrame{
    
    [_wsgw mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left).with.offset((self.view.frame.size.width/4-40)/2);
        make.top.equalTo(self.view.mas_top).with.offset(10);
        make.width.equalTo(@40);
        make.height.equalTo(@40);
    }];
    
    [_dc mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_wsgw.mas_right).with.offset(self.view.frame.size.width/4-40);
        make.top.equalTo(_wsgw.mas_top);
        make.width.equalTo(_wsgw.mas_width);
        make.height.equalTo(_wsgw.mas_height);
    }];
    
    [_gh mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_dc.mas_right).with.offset(self.view.frame.size.width/4-40);
        make.top.equalTo(_wsgw.mas_top);;
        make.width.equalTo(_wsgw.mas_width);
        make.height.equalTo(_wsgw.mas_height);
    }];
    
    [_cgyd mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_gh.mas_right).with.offset(self.view.frame.size.width/4-40);
        make.top.equalTo(_wsgw.mas_top);;
        make.width.equalTo(_wsgw.mas_width);
        make.height.equalTo(_wsgw.mas_height);
    }];
    
    
    
    [_sxps mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_wsgw.mas_left);
        make.top.equalTo(_wsgw.mas_bottom).with.offset(30);
        make.width.equalTo(_wsgw.mas_width);
        make.height.equalTo(_wsgw.mas_height);
    }];
    
    [_jzfw mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_dc.mas_left);
        make.top.equalTo(_sxps.mas_top);
        make.width.equalTo(_wsgw.mas_width);
        make.height.equalTo(_wsgw.mas_height);
    }];
    
    [_zhbx mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_gh.mas_left);
        make.top.equalTo(_sxps.mas_top);;
        make.width.equalTo(_wsgw.mas_width);
        make.height.equalTo(_wsgw.mas_height);
    }];
    
    [_dd mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_cgyd.mas_left);
        make.top.equalTo(_sxps.mas_top);;
        make.width.equalTo(_wsgw.mas_width);
        make.height.equalTo(_wsgw.mas_height);
    }];
    
    
    
}

-(void)addlabel{

    _wsgwLabel = [[UILabel alloc]init];
    _wsgwLabel.text = @"网上购物";
    _wsgwLabel.font =[UIFont fontWithName:@"Helvetica" size:12];
    _wsgwLabel.textAlignment = NSTextAlignmentCenter;
    [self labelColor:_wsgwLabel];
    [self.view addSubview:_wsgwLabel];
    
    _dcLabel = [[UILabel alloc]init];
    _dcLabel.text =@"订餐";
    _dcLabel.font =[UIFont fontWithName:@"Helvetica" size:12];
    _dcLabel.textAlignment = NSTextAlignmentCenter;
    [self labelColor:_dcLabel];
     [self.view addSubview:_dcLabel];
    
    _ghLabel = [[UILabel alloc]init];
    _ghLabel.text=@"挂号";
    _ghLabel.font =[UIFont fontWithName:@"Helvetica" size:12];
    _ghLabel.textAlignment = NSTextAlignmentCenter;
    [self labelColor:_ghLabel];
     [self.view addSubview:_ghLabel];
    
    _cgLabel = [[UILabel alloc]init];
    _cgLabel.text=@"场馆预订";
    _cgLabel.font =[UIFont fontWithName:@"Helvetica" size:12];
    _cgLabel.textAlignment = NSTextAlignmentCenter;
    [self labelColor:_cgLabel];
     [self.view addSubview:_cgLabel];
    
    _sxpsLabel = [[UILabel alloc]init];
    _sxpsLabel.text =@"生鲜配送";
    _sxpsLabel.font =[UIFont fontWithName:@"Helvetica" size:12];
    _sxpsLabel.textAlignment = NSTextAlignmentCenter;
    [self labelColor:_sxpsLabel];
     [self.view addSubview:_sxpsLabel];
    
    _jzfwLabel = [[UILabel alloc]init];
    _jzfwLabel.text =@"家政服务";
    _jzfwLabel.font =[UIFont fontWithName:@"Helvetica" size:12];
    _jzfwLabel.textAlignment = NSTextAlignmentCenter;
    [self labelColor:_jzfwLabel];
     [self.view addSubview:_jzfwLabel];
    
    _zhbxLabel = [[UILabel alloc]init];
    _zhbxLabel.text =@"住户维修";
    _zhbxLabel.font =[UIFont fontWithName:@"Helvetica" size:12];
    _zhbxLabel.textAlignment = NSTextAlignmentCenter;
    [self labelColor:_zhbxLabel];
     [self.view addSubview:_zhbxLabel];
    
    _ddLabel = [[UILabel alloc]init];
    _ddLabel.text =@"视频通话";
    _ddLabel.font =[UIFont fontWithName:@"Helvetica" size:12];
    _ddLabel.textAlignment = NSTextAlignmentCenter;
    [self labelColor:_ddLabel];
     [self.view addSubview:_ddLabel];

}

-(void)setLabelView{

    [_wsgwLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_wsgw.mas_bottom);
        make.height.equalTo(@20);
        make.right.equalTo(_wsgw.mas_right);
        make.width.equalTo(@48);
    }];

    [_dcLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_dc.mas_bottom);
        make.height.equalTo(@20);
        make.right.equalTo(_dc.mas_right);
        make.width.equalTo(_wsgwLabel.mas_width);
    }];

    [_ghLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_gh.mas_bottom);
        make.height.equalTo(@20);
        make.right.equalTo(_gh.mas_right);
       make.width.equalTo(_wsgwLabel.mas_width);
    }];

    [_cgLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_cgyd.mas_bottom);
        make.height.equalTo(@20);
        make.right.equalTo(_cgyd.mas_right);
       make.width.equalTo(_wsgwLabel.mas_width);
    }];

    [_sxpsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_sxps.mas_bottom);
        make.height.equalTo(@20);
        make.right.equalTo(_sxps.mas_right);
       make.width.equalTo(_wsgwLabel.mas_width);
    }];

    [_jzfwLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_jzfw.mas_bottom);
        make.height.equalTo(@20);
        make.right.equalTo(_jzfw.mas_right);
        make.width.equalTo(_wsgwLabel.mas_width);
    }];

    [_zhbxLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_zhbx.mas_bottom);
        make.height.equalTo(@20);
        make.right.equalTo(_zhbx.mas_right);
       make.width.equalTo(_wsgwLabel.mas_width);
    }];

    [_ddLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_dd.mas_bottom);
        make.height.equalTo(@20);
        make.right.equalTo(_dd.mas_right);
       make.width.equalTo(_wsgwLabel.mas_width);
    }];




}

-(void)labelColor :(UILabel *)label{

label.textColor =[UIColor colorWithRed:136/255.0 green:136/255.0 blue:136/255.0 alpha:1];
}

-(void)click{

//    ShoppingTableViewController *ickImageViewController = [[ShoppingTableViewController alloc] init];
//    [self.navigationController pushViewController: ickImageViewController animated:true];


}


@end
